//
//  ViewController.m
//  播放音乐(AVPlayer)
//
//  Created by 刘家俊 on 17/4/7.
//  Copyright © 2017年 Andrew. All rights reserved.
//

#import "ViewController.h"
#import "LocationViewController.h"
#import "NetworkMusicViewController.h"

@interface ViewController () <UITableViewDelegate ,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    
    if (indexPath.row == 0) {
        cell.textLabel.text = @"播放本地音乐";
    } else if (indexPath.row == 1) {
        cell.textLabel.text = @"播放网络音乐";
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        
        LocationViewController *vc = [[LocationViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    } else if (indexPath.row == 1) {
        NetworkMusicViewController *vc = [[NetworkMusicViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}


@end
